library(gplots)


# Selective sweeps

ress <- read.csv("clones.analysis.csv",header=FALSE)

selmulab <- c("s=0.001","s=0.01","s=0.1","s=0.5","s=1","s=2")

pdf("number.of.reproductive.hits.pdf",width=6, height=6)

for(selmu in 1:6){

res <- ress[((selmu-1)*4+1):(selmu*4),]
colnames(res) <- c("r=0","r=0.25","r=0.5","r=0.75","r=1")
for(i in 1:1){
rownames(res) <- c("m=10^-5","m=10^-6","m=10^-7","m=10^-8")
}

res <- as.matrix(res)
mp <- barplot2(res/9, beside = TRUE,
        col = gray(1-(0:3/3)),
	ylim = c(0,max(res/9)+10),        
        main = paste("Selective coefficient (s)", selmulab[selmu]), font.main = 4,
        plot.grid = TRUE)
#mtext(side = 1, at = colMeans(mp), line = 2, text = paste("Mean", formatC(colMeans(res))), col = "red")
legend(19,max(res/9)+10,legend=rownames(res),fill=gray(1-(0:3/3)))
mtext(side=2, text="Average number of reproductive hits per run",line=2)
mtext(side=1, text="Crypt division probability (r) and selective mutation rate (m)",line=2)

}

dev.off()


